package com.bishe.demo.modules.hotel.hotelPolicy.dao;

import com.bishe.demo.modules.hotel.hotelPolicy.entity.BreakfastType;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface BreakfastTypeDao {
    @Insert("insert into hotel_breakfast_type values(null,#{breakfastType})")
    @Options(useGeneratedKeys = true, keyProperty = "breakfastTypeId", keyColumn = "breakfast_type_id")
    void insertBreakfastType(BreakfastType breakfastType);

    @Select("select * from hotel_breakfast_type hbt left join hotel_breakfast_breakfast_type hbbt on hbbt.breakfast_type_id=hbt.breakfast_type_id where hbbt.breakfast_id=#{breakfastId}")
    List<BreakfastType> getBreakfastTypesByBreakfastId(int breakfastId);

    @Delete("delete from hotel_breakfast_type where breakfast_type_id=#{breakfastTypeId}")
    void deleteById(int breakfastTypeId);
}
